<h3><?php echo $title; ?></h3>

<script>

$(document).ready(function() {
$('#selectall').click(function()
{
	$('input:checkbox').attr('checked',true);
//	$("#area").slideDown(400);
});

$('#removeall').click(function()
{
	$('input:checkbox').attr('checked',false);
//	$("#area").slideUp(300);
});
}); 
</script>


<?php $row= $result[0]; echo form_open_multipart('admin/permission/update/'.$row['per_id']); ?>

<div class="control2">

<?php

	echo form_submit('update', 'Save');

	echo form_submit('close', 'Close');

?>

</div><!--control2 end-->


<div class="box_ex">

<?php 
	
  echo '<p class="error"></p>';

   
   if(isset($missing) && is_array($missing) )
   {
  
   echo "<div class='error' style='text-align:center'>";
   foreach($missing as $item)
   {
   		echo $item."<br />";
   }
   echo "</div>";
   }
  
  //================THÔNG TIN XÁC THỰC================

  echo '<p class="title">'.$this->lang->line('title_user_info').'</p>';


	// username

	echo '<div class="inner">';

  $code = 'name';

   $label ='Chức danh';

 if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error width-185'));

	else

		echo form_label($label, '', array('class'=>'width-185'));

$data = array('name'=>$code, 'class'=>'width-185','value'=>$row['per_name']);

  echo form_input($data, set_value($code));

	echo '</div>';
	
	
		echo '<div class="inner" id="area" >';

  $code = 'area';

  $label ='Thuộc siêu thị';

 if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error width-185'));

	else

		echo form_label($label, '', array('class'=>'width-185'));

  //echo form_input($code, set_value($code));
	?>
    <select name="area"  > 
    <option value="-1"> ---- Chọn khu vực  ---- </option>
    <option value="0" <?php echo ($row["per_area"] =="0") ?  "selected='selected'" :  ""; ?> > Tất cả </option>
    	<option value="1" <?php echo ($row["per_area"]=="1") ?  "selected='selected'" :  ""; ?> > An Phú </option>
        <option value="2" <?php echo ($row["per_area"]=="2") ?  "selected='selected'" :   ""; ?>> Phú Mỹ </option>
        <option value="3" <?php echo ($row["per_area"]=="3") ?  "selected='selected'" :  ""; ?>> Hưng Gia </option>
    </select>
    
    
    <?php


	echo '</div>';


?>
<div style="vertical-align:text-top;padding-left:27px;">
<?php
/*	$label=$this->lang->line('component_product');
	$style = array("style"=>"vertical-align:top");
	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label,"",$style);
*/
?>

		<?php 
			$rule = array("user","news","cart","product","sub_cate","cate",);
		/*	foreach($comp as $item)
			{
				$name = unserialize($item['cpnt_name']);
				//$info = unserialize($item['cpnt_info']);
				echo '<option value="'.$item['cpnt_id'].'">'.$name['vi'].'</option>';
			}
			
		*/
			if($row['per_module'] == "fullcontrol" ||$row['per_module'] == "" )
			{	$module= $row['per_module'];
				
			}else
				$module=  unserialize($row['per_module']);
			
		
			?>    
                
		<fieldset  style="text-align:left;width:500px"> <legend style="text-align:left;"> Chọn Quyền truy cập</legend> 
        <table width="450"  style=""> 
<?php 
		echo '<a href="#" id="selectall" style="color:#99;text-decoration:none" >Chọn tất cả</a> | <a href="#" id="removeall" style="color:#999;text-decoration:none" >Bỏ chọn</a>';
//echo '';
		if(is_array($module) )
			{
	//	echo "<table > ";
		echo "<tr>";
		echo "<td>";
		echo form_checkbox('component[]', "permission",((is_array($module) && in_array("permission",$module))) ? "true":"") ;
		echo " Quyền hạn";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "user",((is_array($module) && in_array("user",$module))) ? "true":""); 
		echo " Thành viên";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "cart",((is_array($module) && in_array("cart",$module))) ? "true":"");
		echo " Đơn đặt hàng";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td>";
		echo form_checkbox('component[]', "news",((is_array($module) && in_array("news",$module))) ? "true":"");
		echo " Tin tức";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "product",((is_array($module) && in_array("product",$module))) ? "true":"");
		echo " Sản phẩm"; 
echo "</td>";
echo "<td>";												echo form_checkbox('component[]', "cate",((is_array($module) && in_array("cate",$module))) ? "true":"");
						echo " Ngành hàng - Nhóm hàng";
		echo "</td>";
		
		echo "</tr>";
			}
			else
			{
				echo "<tr>";
		echo "<td>";
		echo form_checkbox('component[]', "permission",true);
		echo " Quyền hạn";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "user",true); 
		echo " Thành viên";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "cart",true);
		echo " Đơn đặt hàng";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td>";
		echo form_checkbox('component[]', "news",true);
		echo " Tin tức";
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "product",true);
		echo " Sản phẩm"; 
		echo "</td>";
		echo "<td>";
		echo form_checkbox('component[]', "cate",true);
		echo " Ngành hàng - Nhóm hàng";
		echo "</td>";
		echo "</tr>";
		
			}
	echo "</table>";
	echo '</fieldset>';

echo '</div>';
	
	
	
	
		echo '<div class="inner">';
	echo "<p>&nbsp;</p>";
 
	echo '</div>';


?>
        
</div>


</div><!--end box-->



<?php

	echo form_close(); //FORM END

?>



